package hu.myai.gui;

import hu.myai.gui.widgets.graph.GraphFactory;
import hu.myai.gui.widgets.graph.ScalarGraph;
import hu.myai.gui.widgets.model.Partition;
import hu.myai.gui.widgets.model.Scalar;
import hu.myai.gui.widgets.model.Partition.Interval;
import hu.myai.gui.widgets.panel.Panel;
import hu.myai.gui.widgets.panel.PanelData;
import hu.myai.gui.widgets.panel.PanelLayout;

import java.util.ArrayList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart {
	public static final String ID = "hu.myai.gui.view";

	public void createPartControl(Composite parent) {
		Panel panel = new Panel(parent, SWT.NONE);
		panel.setLayout(new PanelLayout(panel));
		panel.setRows(1);
		panel.setColumns(1);

		ArrayList<Interval> intervalsGraph = new ArrayList<Interval>();
		intervalsGraph.add(new Interval(1.2, "low", 240, 240, 240));
		intervalsGraph.add(new Interval(1.5, "intermediate", 230, 230, 0));
		// intervalsGraph.add(new Interval(3.0, "high", 255, 208, 208));
		// intervalsGraph.add(new Interval(5.0, "very high", 255, 100, 100));

		ScalarGraph sg = GraphFactory.createGraph("basic", panel, new Partition(intervalsGraph), new Scalar(8000), " Graph ");
		PanelData pd = new PanelData(0, 0, 1, 1);
		sg.setLayoutData(pd);

		MyaiPlugin myPlugin = new MyaiPlugin();
		myPlugin.initTick(sg);

		myPlugin.start();
	}

	public void setFocus() {
	}
}